package com.cin.cma.server.pos.common.extension;


import com.cin.cma.common.constant.EventConstant;
import com.cin.cma.common.exception.UserFriendlyException;
import com.cin.cma.common.constant.FunctionCode;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @Date：2024-07-18 20:56
 */
public class EventConvert {
    static Map<String, String> eventMap = new HashMap<>();

    static {
        eventMap.put(FunctionCode.BASIC_GET_PASS_NUM, EventConstant.Basic.BASIC_GET_PASS_NUMBER);
        eventMap.put(FunctionCode.BASIC_GET_LOCAL_CINEMA, EventConstant.Basic.BASIC_GET_LOCAL_CINEMA);
        eventMap.put(FunctionCode.BASIC_BOOKING_ORDER, EventConstant.Basic.BASIC_BOOKING_ORDER);
        eventMap.put(FunctionCode.BASIC_SYSTEM_TIME, EventConstant.Basic.BASIC_GLOBAL_SYSTEM_TIME);
        eventMap.put(FunctionCode.BASIC_GET_IBT, EventConstant.Basic.BASIC_GET_INCREASE_BOOKING_SETTING);
        eventMap.put(FunctionCode.BASIC_GET_ALLSYSTEMSETTING, EventConstant.Basic.BASIC_ALL_SYSTEM_SETTING);
        eventMap.put(FunctionCode.CARD_CONSUME, EventConstant.Card.CARD_CONSUME);
        eventMap.put(FunctionCode.CARD_INFORMATION, EventConstant.Card.CARD_GET_CARD_INFO);
        eventMap.put(FunctionCode.CARD_CONSUME_ROLLBACK, EventConstant.Card.CARD_CONSUME_ROLLBACK);
        eventMap.put(FunctionCode.CARD_GET_GETSUMMARYINFO, EventConstant.Card.CARD_SUMMARY_INFO);
        eventMap.put(FunctionCode.CARD_ADD_MONEY, EventConstant.Card.CARD_ADD_MONEY);
        eventMap.put(FunctionCode.CARD_BUYING, EventConstant.Card.CARD_BUYING);
        eventMap.put(FunctionCode.CARD_GET_ADDMONEY, EventConstant.Card.CARD_GET_ADD_MONEY);
        eventMap.put(FunctionCode.CARD_GET_MARKING, EventConstant.Card.CARD_GET_MARKING);
        eventMap.put(FunctionCode.CARD_RESETPASSWORD, EventConstant.Card.CARD_RESET_PWD);
        eventMap.put(FunctionCode.CARD_LOCK, EventConstant.Card.CARD_LOCK);
        eventMap.put(FunctionCode.CARD_ACTIVATION, EventConstant.Card.CARD_ACTIVATION);
        eventMap.put(FunctionCode.CARD_EDITMEMBERINFO, EventConstant.Card.CARD_EDIT_MEMBER_INFO);
        eventMap.put(FunctionCode.CARD_SELL, EventConstant.Card.CARD_SELL);
        eventMap.put(FunctionCode.CARD_SELL_RECHARGE, EventConstant.Card.CARD_SELL_RECHARGE);
        eventMap.put(FunctionCode.CARD_SELL_INFO, EventConstant.Card.CARD_SELL_INFO);
        eventMap.put(FunctionCode.CARD_GET_USE_POLICY_LIST, EventConstant.Card.CARD_GET_USE_POLICY_LIST);
        eventMap.put(FunctionCode.CARD_USE_POLICY, EventConstant.Card.CARD_USE_POLICY);
        eventMap.put(FunctionCode.CARD_GET_GRADE_POLICY_LIST, EventConstant.Card.CARD_GET_GRADE_LIST);
        eventMap.put(FunctionCode.DATAINF_SOFTWARE_VERSION, EventConstant.DataInf.DATAINF_GET_SOFTWARE_VERSION);
        eventMap.put(FunctionCode.TICKET_GET_SESSIONS, EventConstant.Ticket.TICKET_GET_SESSION);
        eventMap.put(FunctionCode.TICKET_GET_SESSION_FILMS, EventConstant.Ticket.TICKET_GET_SESSION_FILMS);
        eventMap.put(FunctionCode.TICKET_GET_HALLS, EventConstant.Ticket.TICKET_GET_HALLS);
        eventMap.put(FunctionCode.TICKET_GET_CINEMA_SECTIONS, EventConstant.Ticket.TICKET_GET_SECTIONS);
        eventMap.put(FunctionCode.TICKET_GET_SEATPLAN, EventConstant.Ticket.TICKET_GET_SEAT_PLAN);
        eventMap.put(FunctionCode.TICKET_GET_SESSION_PRICEPOLICY, EventConstant.Ticket.TICKET_GET_SESSION_PRICE_POLICY);
        eventMap.put(FunctionCode.TICKET_GET_BOOKING_ID, EventConstant.Ticket.TICKET_GET_BOOKING_ID);
        eventMap.put(FunctionCode.TICKET_LOCK_SEATS, EventConstant.Ticket.TICKET_REPOSITION_SEATS);
        eventMap.put(FunctionCode.TICKET_UNLOCK_SEATS, EventConstant.Ticket.TICKET_RELEASE_SEATS);
        eventMap.put(FunctionCode.TICKET_GET_SESSION_SEATS, EventConstant.Ticket.TICKET_GET_ALLOCATE_SEATS);
        eventMap.put(FunctionCode.TICKET_GET_CONFIRM_ID, EventConstant.Ticket.TICKET_GET_CONFIRM_ID);
        eventMap.put(FunctionCode.TICKET_QUERY_ORDER, EventConstant.Ticket.TICKET_QUERY_ORDER);
        eventMap.put(FunctionCode.TICKET_GET_BOOKING_BILL, EventConstant.Ticket.TICKET_GET_BOOKING_BILL);
        eventMap.put(FunctionCode.TICKET_GET_TICEKTS_INFO, EventConstant.Ticket.TICKET_GET_TICKETS);
        eventMap.put(FunctionCode.TICKET_REFUND, EventConstant.Ticket.TICKET_REFUND);
        eventMap.put(FunctionCode.TICKET_GET_CARD_PRICEPOLICY, EventConstant.Ticket.TICKET_CARD_PRICE_POLICY);
        eventMap.put(FunctionCode.TICKET_GET_FILMS_IMAGE, EventConstant.Ticket.TICKET_FILM_IMAGE);
        eventMap.put(FunctionCode.VOUCHER_REFUND, EventConstant.Voucher.VOUCHER_REFUND);
        eventMap.put(FunctionCode.VOUCHER_GET, EventConstant.Voucher.VOUCHER_GET);
        eventMap.put(FunctionCode.VOUCHER_TEMP_LOCK, EventConstant.Voucher.VOUCHER_TEMP_LOCK);
        eventMap.put(FunctionCode.VOUCHER_REDEEM, EventConstant.Voucher.VOUCHER_REDEEM);
        eventMap.put(FunctionCode.VOUCHER_REDEEM_ROLLBACK, EventConstant.Voucher.VOUCHER_REDEEM_ROLLBACK);
        eventMap.put(FunctionCode.VOUCHER_GET_PAYPOLICY, EventConstant.Voucher.VOUCHER_GET_PAY_POLICY);
        eventMap.put(FunctionCode.POS_GET_CLASS, EventConstant.Goods.GOODS_GET_GOODS_CLASS);
        eventMap.put(FunctionCode.POS_SELECT_HOTSALE_DTLS, EventConstant.Goods.GOODS_GET_GOODS_HOT);
        eventMap.put(FunctionCode.POS_GET_GOODS, EventConstant.Goods.GOODS_GET_GOODS_LIST);
        eventMap.put(FunctionCode.POS_GET_FAVOURABLE_FORMULA, EventConstant.Goods.GOODS_GET_GOODS_PACKAGE);
        eventMap.put(FunctionCode.POS_GET_FAVOURABLE_FORMULA_DETAILS, EventConstant.Goods.GOODS_GET_PACKAGE_DETAILS);
        eventMap.put(FunctionCode.POS_SELECT_ORDER_INFO, EventConstant.Goods.GOODS_GET_ORDER_INFO);
    }

    public static String toEvent(String functionCode) throws UserFriendlyException {
        return eventMap.getOrDefault(functionCode, EventConstant.Other.OTHER_CUSTOM);
    }
}
